<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    
    <style>
         #app {
            margin: 25px 0 0 58px;
        }
        .right{
            width: 85%;
            height: 369px;
            border: 1px solid #ccc;
            float: left;
        }
        .right-content{
            width: 17%;
            margin: 1%;
            height: 300px;
        }
        button{
            width: 100%;
            height: 11.11%;
        }
    </style>
</head>
<body>
    <div id='app'>
        <div style="width: 10%; height: 369px ; float: left" class="list-group">
            <button v-for="(item) in leftList" @click="choose(item.categoryId)">{{item.name}}</button>
        </div>
        <div class="right">
            <img :src="item1.coverImgUrl" class="right-content" alt=""  v-for="item1 in rightList">
        </div>
    </div>
    <script>
    const vm = new Vue({
        el: '#app',
        data: {
            leftList: null,
            rightList:null,
        },
        //左侧
        created() {
                let options = {
                    emulateJSON: true,
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                }
                //左侧列表
                axios.post("http://showme.myhope365.com/api/shop/shopCategory/open/list",  options)
                    .then(({ data }) => {
                        // debugger
                        this.leftList = data.rows
                        // this.choose(0)(
                        // console.log(data))
                        this.choose(1)
                    })
                 
            },
        methods:{
            choose(categoryId){
                // let param=new URLSearchParams()
                let param = new URLSearchParams();
                    param.append('categoryId', categoryId)
                    param.append('pageNum', '1')
                    param.append('pageSize', '9')



                let options = {
                        emulateJSON: true,
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        }
                    }
                    axios.post("http://showme.myhope365.com/api/shop/shopGoods/open/list", param, options)
                        .then(res => {
                            // debugger
                            this.rightList=res.data.rows
                            
                        })

            }
            
        }
    })
    </script>
</body>
</html>